package com.tbit.main.service.impl;

import com.tbit.main.dao.ter.TerAttrDao;
import com.tbit.main.pojo.MachineEvent;
import com.tbit.main.service.MachineAttrService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 终端属性
 *
 * @author Leon
 * 2019年11月19日 上午11:22:43
 */
@Service("machineAttrService")
public class MachineAttrServiceImpl implements MachineAttrService {
    @Autowired
    private TerAttrDao terAttrDao;

    @Override
    public List<MachineEvent> getStopByMachineNOBatch(List<String> machineNOs) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("machineNOs", StringUtil.getArrayListString(machineNOs));
        return terAttrDao.getStopByMachineNOBatch(params);
    }

    @Override
    public List<MachineEvent> getTerAttr(List<String> machineNOs) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("machineNOs", StringUtil.getArrayListString(machineNOs));
        return terAttrDao.getTerAttr(params);
    }

    @Override
    public MachineEvent getByMachineNO(String machineNO, String enent) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("machineNO", machineNO);
        params.put("event", enent);

        return terAttrDao.getByMachineNO(params);
    }

    @Override
    public List<String> getUnLockMachine() {
        return terAttrDao.getUnLockMachine();
    }

	/*@Override
	public List<String> getLockMachine(){
		return terAttrDao.getLockMachine();
	}*/

    @Override
    public MachineEvent getMachineEvent(String machineNO, String attrName) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("machineNO", machineNO);
        params.put("attrName", attrName);
        return terAttrDao.getMachineEvent(params);
    }

}
